const mongoose = require('mongoose');

const url = 'mongodb://127.0.0.1:27017';
const dbName = 'myblog01';

mongoose.connect(`${url}/${dbName}`, {
    useNewUrlParser: true,
    useUnifiedTopology: true 
})
const db = mongoose.connection;
db.on('error', err => {
    console.error('mongoose connection error')
})

// db.once('open', () => {
//     console.log('mongose connection success')

// })
module.exports = mongoose
